package com.motong.gongdan.vo.H5Vo.lamp.query;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@ApiModel("联络灯看板参数")
@Accessors(chain = true)
@Data
public class LampDashboardQuery {

    @ApiModelProperty(value = "联络灯类型(多个,号隔开)")
    private String type;

    @ApiModelProperty(value = "分组id")
    private String groupId;

    @ApiModelProperty(value = "页码")
    private Integer page = 1;

    @ApiModelProperty(value = "条数")
    private Integer limit = -1;

    @ApiModelProperty(value = "每台设备联络灯请求最大数量", hidden = true)
    private Integer maxLampRequestNum = 4;

    @ApiModelProperty(value = "是否获取类型数量统计", hidden = true)
    private Boolean typeCount = true;

    @ApiModelProperty(value = "仅显示有请求的设备")
    private Boolean haveRequest = false;

    @ApiModelProperty(value = "类型id数组", hidden = true)
    private List<String> typeList = new ArrayList<>();

    /*逗号分隔格式化为数组*/
    public void setType(String type) {
        if (StringUtils.hasLength(type)) {
            typeList.addAll(Arrays.asList(type.split(",")));
        }
        this.type = type;
    }
}
